home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / battutor.arc / _FUNKY.REM < prev    next >
Text File  |  1986-05-05  |  5KB  |  125 lines

  1.                              Text File   _funky.rem
  2.  
  3.  
  4.  
  5.  
  6.                                 FUNKY.COM
  7.  
  8. The purpose of the FUNKY utility is to allow the user of a Batch File to answer
  9. a prompting message or comment with any key that generates an "extended" key
  10. code.  Examples of such keys include the Function Keys F1 - F10 (also, the
  11. shifted, Ctrl, and Alt F1 - F10), the Cursor Control ("arrow") keys, and many
  12. other Alt and Ctrl key combinations.  A complete list is available later in
  13. this tutorial.  When the user answers the prompt with such a key, the FUNKY
  14. utility then sets the system "errorlevel" parameter so that a subsequent IF
  15. subcommand in the Batch File can branch accordingly.  FUNKY will optionally
  16. execute some display formatting commands before it displays a prompt string.
  17.  
  18.  
  19. The format of the FUNKY command line is shown below, with the usual convention
  20. that items in brackets  [ ]  are optional.
  21.  
  22.         FUNKY    [ /  [ c1 [ c2 ... ] ]  / ]   [ string ]
  23.  
  24. where  c1, c2, etc are optional formatting commands enclosed in slashes.
  25. These commands are executed in the order they are encountered, before the
  26. string is displayed.  The one-letter commands that are currently supported
  27. include the following:
  28.  
  29.  
  30.         B  or  b        Beep the console
  31.  
  32.         L  or  l        Skip one line
  33.  
  34.         D  or  d        Display a "delimiting" border across the screen.
  35.  
  36.  
  37. After the "slash" commands are executed, the string is displayed.  If no
  38. slashes precede the string, the leading blanks and tabs are discarded.  If
  39. slashes were present, then all characters after the second slash are
  40. displayed.
  41.  
  42. The only constraint on the string's characters is that "<", "|", and ">" must
  43. not be used in the string.
  44.  
  45. Following the string, a reverse video "box" is displayed.  When the user
  46. responds with a keystroke, the box "un-reverses".  Usually, extended keycodes
  47. do not display on the screen.
  48.  
  49. FUNKY then returns to the Batch File with the errorlevel parameter set to the
  50. extended code of the key that was struck.  Representative examples of extended
  51. keys are as follows:
  52.  
  53.         59 - 68         Function keys F1 - F10 (base case)
  54.  
  55.         71              Home
  56.  
  57.         72              Cursor up arrow
  58.  
  59.         73              Pg Up
  60.  
  61.         75              Cursor left arrow
  62.  
  63.         77              Cursor right arrow
  64.  
  65.         79              End
  66.  
  67.         80              Cursor down arrow
  68.  
  69.         81              Pg Dn
  70.  
  71.  
  72. If a key without an extended code (most alphanumeric and punctuation keys) is
  73. typed, then FUNKY returns the following errorlevel codes:
  74.  
  75.  
  76.         0               If the key is ESC
  77.  
  78.         255             For any other "non-extended" key
  79.  
  80.  
  81. Let's return to Batch File execution and show a simple example of FUNKY and how
  82. to test the errorlevel code with subsequent IF subcommands.  We'll first
  83. display the command lines in these comments, and then we will return to the
  84. Batch File and execute the same command lines.
  85.  
  86. Here are the command lines:
  87.  
  88.         echo    F1      Batch Files are useful and increase productivity.
  89.         echo    F2      Batch Files are unfathomable and a general pain.
  90.         echo    F3      Batch Files are @#$%#$@% !!!
  91.         funky/llb/              Please select one of the above :
  92.         if not errorlevel 1 goto esc
  93.         if not errorlevel 59 goto below
  94.         if errorlevel 255 goto non_ext
  95.         if errorlevel 62 goto higher
  96.         if errorlevel 61 goto f3_typed
  97.         if errorlevel 60 goto f2_typed
  98.         echo    You pressed F1.  I find them useful, too!
  99.         goto continue
  100.         :esc
  101.         echo    You struck ESC.  Are you trying to sneak out?
  102.         goto continue
  103.         :below
  104.         echo    You pressed a key with an extended code below 59.
  105.         goto continue
  106.         :non_ext
  107.         echo    You pressed a non-extended key.
  108.         goto continue
  109.         :higher
  110.         echo    You pressed a key with an extended code above 61.
  111.         goto continue
  112.         :f3_typed
  113.         echo    Now, Now. It's not THAT bad.
  114.         goto continue
  115.         :f2_typed
  116.         echo    Well, I felt that way until I wrote these utilities ...
  117.         :continue
  118.  
  119.  
  120. You can't see the whole sequence now ( printing a listing of these tutorial
  121. files for a guide helps ), but you probably have the idea.  Let's go back to
  122. Batch file execution and execute the command lines above.   Here goes ...
  123. el 1 goto 1disks
  124.           slash/l/No floppies???